﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jumpton.SFA.Server.Entity;
using Jumpton.Persistent;
using Jumpton.Data;
using System.Data;

namespace Jumpton.SFA.Server.BusinessRule.MasterData
{
    public class CustomerProductListItemManager : BusinessLogic
    {
        //public ObjectTable GetCourseTable()
        //{
        //    return new ObjectTable(typeof(CUSTOMER_PROD_LIST_ITEMS));
        //}
        public ObjectTable GetCourseTable(decimal domainID)
        {
            return new ObjectTable(typeof(CUSTOMER_PROD_LIST_ITEMS), "this.DOMAINID='" + domainID + "'");
        }
        public CUSTOMER_PROD_LIST_ITEMS Load(int id)
        {
            return (CUSTOMER_PROD_LIST_ITEMS)ObjectRow.Load(typeof(CUSTOMER_PROD_LIST_ITEMS), string.Format("this.ID='{0}'", id));
        }

        public static DataSet GetProductListItem(int listID,string categoryCode,string bandCode,string mauCode,string formcode,decimal domainID,string IsSelected)
        {
            return SqlData.OpenSP("usp_SelectCUSTOMER_PROD_LIST_ITEMSsByCUSTOMER_PRODUCT_LIST_ID", listID, categoryCode, bandCode, mauCode,formcode,domainID,IsSelected);
        }

        public bool Save(CUSTOMER_PROD_LIST_ITEMS item)
        {
            bool Successful = false;
            if (item != null)
            {
                try
                {
                    item.Save();
                    Successful = true;
                }
                catch (Exception err)
                {
                    message = err.Message;throw err;
                    
                }
            }

            return Successful;
        }

    }
}
